# -*- coding: utf-8 -*-
# @Time:    2023-05-11 16:03
# @Author:  geng
# @Email:   yonglonggeng@163.com
# @WeChat:  superior_god
# @File:    04create_voc_map.py
# @Project: bbox_detection_ai
# @Package: 
# @Ref:
import os

texts = []
for jpg in os.listdir("data_dataset_voc/JPEGImages"):
    text = "data_dataset_voc/JPEGImages/" + jpg + " " + "data_dataset_voc/Annotations/" + jpg.split(".")[0] + ".xml"
    print(text)
    texts.append(text)
print(texts)

from random import sample

with open("train_list.txt", 'w') as file:
    for text in sample(texts, int(0.8 * len(texts))):
        file.write(text + "\n")

with open("val_list.txt", 'w') as file:
    for text in sample(texts, int(0.2 * len(texts))):
        file.write(text + "\n")
